﻿<%@ Page Language="C#" CodeFile="urlredirect.aspx.cs" Inherits="urlredirect" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html id="htmlID" runat="server"> <head>
<script src="Scripts/jquery-3.1.0.js" type="text/javascript"></script>
<style type="text/css">
input 
{
position: absolute;
left: 60px;
}
div 
{
font-size: 1em;
height: 30px;
}
#id_btn_open
{
position: absolute;
left: 80px;
display:inline-block;
width: 60px;
height: 20px;
/*background-color: rgb(102, 153, 68);*/
}

#id_open
{
display: block;
width: 30px;
margin: 0 auto;
}
#id_save 
{
position: absolute;
left: 80px;
}
</style>
<script src="Scripts/jquery-3.1.0.js" type="text/javascript"></script> </head> <body> <div> <div id='id_btn_open'> <a id='id_open'>Open</a> </div> </div> <div> Name:<input id='id_name' type='text' /> </div> <div> URL:<input id='id_url' type='text' /> </div> <div> Note:<input id='id_note' id type='text' /> </div> <div> <div id='id_btn_save'> <a id='id_save'>Save</a> </div> </div> <script>
function getURLParameter(name) {
    var reg = new RegExp('[?|&]' + name + '=' + '([^&]+?)(&|#|;|$)');
    return decodeURIComponent((reg.exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null;
}

!!(function () {
var g = {};
g.url = getURLParameter('url');
g.name = getURLParameter('name');
g.note = getURLParameter('note');

var MobileUA = (function () {
var ua = navigator.userAgent.toLowerCase();
var mua = {
IOS: /ipod|iPhone|ipad/.test(ua), //iOS 
IPHONE: /iphone/.test(ua), //iPhone 
IPAD: /ipad/.test(ua), //iPad 
android: /android/.test(ua), //Android Device 
Windows: /windows/.test(ua), //Windows Device 
TOUCH_DEVICE: ('ontouchstart' in window) || /touch/.test(ua), //Touch Device 
MOBILE: /mobile/.test(ua), //Mobile Device (iPad) 
ANDROID_TABLET: false, //Android Tablet 
WINDOWS_TABLET: false, //Windows Tablet 
TABLET: false, //Tablet (iPad, Android, Windows) 
SMART_PHONE: false //Smart Phone (iPhone, Android) 
};
mua.ANDROID_TABLET = mua.ANDROID && !mua.MOBILE;
mua.WINDOWS_TABLET = mua.WINDOWS && /tablet/.test(ua);
mua.TABLET = mua.IPAD || mua.ANDROID_TABLET || mua.WINDOWS_TABLET;
mua.SMART_PHONE = mua.MOBILE && !mua.TABLET;
return mua;
} ()); //SmartPhone 

if (MobileUA.SMART_PHONE == false) { // 非移动端链接地址 
document.location.href = getURLParameter('url');
}


$('#id_open')[0].href = g.url;
$('#id_name')[0].value = g.name;
$('#id_url')[0].value = g.url;
$('#id_note')[0].value = g.note;
})(); </script> </body> </html> 
